//要连接高亮还是要这个
import { Link as StaticLink, exec } from './index';

export class Match extends Element{
	this(props, kids) { 
		this.url = props.href;
		console.log(this.url,111111);
		this.kids = kids;
	  }
	
    //按键后的回调
	update = url => {
		this.nextUrl = url;
        console.log(url,"回调");
	};
    //加载成功后的事件
	componentDidMount() {
		subscribers.push(this.url);
	}
    //析构后，也就是删除后
	componentWillUnmount() {
		subscribers.splice(subscribers.indexOf(this.url), 1);
	}
    
	render(props, kids) {
       // let  matches = ( exec(path, props.path, {}) !== false );





	
        
       // let myclassName = [props.class || props.className, matches && activeClassName].filter(Boolean).join(' ');
		
		
		return  <StaticLink href={this.url}   >{kids}</StaticLink>
             
	}
}

export const Link = ({ activeClassName, path, ...props },kids) => (   
	<Match url={path || props.href}  {...props} activeClassName={activeClassName}  >{kids}</Match>
);

export default Match;
Match.Link = Link;
